from variable import Variable
from operate import confirm_step, left_click
import time
from util import go_position, go_home
from fight.fightUtil import fighting


def fightTwo():
    print("开始幻痛囚笼")
    for i in [[4.5, 1.7, "a组"], [2, 1.7, "b组"], [1.35, 1.7, "y组"]]:
        go_position("fight_two")
        print("开始{}".format(i[2]))
        left_click(Variable.width / i[0], Variable.height / i[1])
        timer = 0
        # 点击作战准备
        while left_click(Variable.width / 1.15, Variable.height / 1.057):
            if not confirm_step("images/fight/choose_team.png"):
                print(f"进入{i[2]}作战失败")
                timer += 1
                if timer > 3:
                    break
            else:
                left_click(Variable.width / 1.164, Variable.height / 1.081)
                # 进入战斗
                fighting("images/fight/fight_two/save_score.png")
                time.sleep(3)
                break

    go_home()
    print("幻痛囚笼完成")


if __name__ == "__main__":
    fightTwo()
